"use strict";
// pages/index/mine.js
var app = getApp()
var util = require('../../../utils/util.js')
var common = require('../../../utils/api.js')
var api = common.api
Page({
  data:{
    list:[],
    scrollViewHeight:'',
    userInfo: {},
    page:'mine',
    cannotFetch:false
  },
  onLoad:function(options){

  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
   
    // 页面初始化 options为页面跳转所带来的参数
    console.log(app.globalData)
    var res = wx.getSystemInfoSync()
    var that = this
    this.setData({scrollViewHeight:res.windowHeight*2-64-64})
    this.setData({globaldata:app.globalData,cannotFetch:false});
    if(!app.globalData.userInfo || util.isEmpty(app.globalData.userInfo)){
      that.setData({cannotFetch:true})
      util.hideLoading()
      console.log("cannotFetch");
      return false
    }
    util.showLoading({title: '加载中'})
    console.log(app.globalData.userInfo)
    var uid = app.globalData.userInfo.id
    api.getuserproductlist(uid,function(result){
      console.log('我参与的项目',result)
      that.setData({list:result.data,userInfo:app.globalData.userInfo})
      util.hideLoading()
    })
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})